All Questions
Tagged with command-linefind
205 questions
0votes
1answer
82views
What if I don't want to display the first directory in the find command?
I don't want to display the first directory component of paths printed by the inner find command from the below example find . ! -name . -prune -type d -exec sh -c ' for dir do echo "\n\n${dir#.*/...
-2votes
1answer
185views
Trying to mount a drive, but Mint can't find it?
I'm trying to mount the NTFS partition as described here https://linuxconfig.org/how-to-mount-partition-with-ntfs-file-system-and-read-write-access The system is installed on sda5 and mounting sda1 is ...
-4votes
1answer
91views
Find actual file by only file name, not literally everything non-related
PuTTY/SSH and logged in as root I simply want to find any instances of the file PEAR.php. I've looked through a dozen different tutorials but they seem to just copy-paste the same instructions. An ...
0votes
3answers
839views
What are the file size options for "find . -size" command?
I found out that to look for file size in bytes, I use 'c'. So I can look for file size with 1000 bytes by using: find . -size 1000c But what about different kind of size such as Mb, Gb or even bits? ...
6votes
3answers
1kviews
How does sort -n command know what it needs to sort by in a file that contains both numbers and text?
I'm reading this blog at the moment: https://www.baeldung.com/linux/dir-find-largest-file-recursively And I am asking about this command: find /usr/lib -type f -printf "%s\t%p\n" | sort -n | ...
1vote
1answer
72views
Rename the sub-sub-directories of a directory named _QWE
I can run a command in all directories named _QWE using: find . -name '_QWE' -type d -execdir touch {}/1234.txt \; However, I need to run -execdir rename 's!^\./(\d+ -)\s(\d+\.)!$1!' {} \; in all the ...
3votes
2answers
2kviews
find -name -path
I have a some tree. . ├── 1 │ └── a │ └── script.a.sh ├── 2 │ └── a │ └── script.b.sh ... └── a └── script.sh And I need to find script.*.sh. I execute ./a/script.sh: #!/bin/bash #...
0votes
3answers
72views
Rename multiple folders using external string manipulation tool
I am using ccase. The following command works. $ mv camelCase (ccase -t Kebab camelCase) Now I am trying to rename multiple directories using: $ find . -type d -execdir rename 's/(.*)/$(ccase -t ...
1vote
0answers
29views
Recursively remove certain folder from entire folder tree [duplicate]
Given a directory projects/ whose subfolders may have a venv/ folder at variable depths projects/foo/src/venv/ # venv/ at depth 2 projects/bar/venv/ # venv/ at depth 1 projects/baz/src/...
0votes
0answers
34views
How find file name by pattern to immediately use it again for the umpteenth time
How do we find file names by pattern to use them, for copy/move or delete etc, again for the umpteenth time in that line CLI, e.g. $ ls .hello-577 .world-999 .foo-444 jjj hello world foo kkk lll so ...
2votes
1answer
376views
Properly tabulating 'find's output with printf and sorting them by date
I'm using gfind running on MacOS, to find text files. I am trying to see the filenames only and the birthdate of my gfind results, and then sorting them by date, and paging them. Is this achievable? ...
0votes
1answer
106views
find command, only execute when file is newer
I have a script that has the following steps: 1 mirror a remote server with lftp open ftps://'[name]':'[pwd]'@[remote_host] set ssl:check-hostname no mirror --delete-first --only-newer /...
10votes
3answers
6kviews
What is the practical purpose of "./" in front of relative file paths (in the output from "find")?
Why are some relative file paths displayed in the form of ./file, instead of just file? For example, when I do: find . I get this output: ./file1 ./file2 ./file3 What is the practical purpose, other ...
0votes
0answers
26views
find command behaving abnormally on rhel7 host
find command seems to be behaving abnormally when used with -user option find /var/tmp -type f -user `whoami` -name * or find /var/tmp -type f -user udunto -name * when used , prints file from root ...
2votes
1answer
915views
How to remember, which order grep and find takes the parameters?
Every time I use grep and find I'm stumbling through, which order I should type the commands: When I should write the path and when I should write the flags, if it needs double quotations or not, etc. ...